// pages/person/plan/plan.js
var dealTime = require('../../../utils/util');
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    navbarData: {
      showCapsule: 1,
      title: '我的预约'
    },
    bgHeight:app.globalData.status+app.globalData.navHeight+10,
    headTop:app.globalData.status+app.globalData.navHeight+20,
    planList:[
      {title:"往事随风",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
      {title:"逆流成河",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
      {title:"沉默的羔羊",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
      {title:"随遇而安",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
      {title:"沉默的羔羊",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
      {title:"随遇而安",date:"2020-12-01  09:00-15:00",phone:"15012698541"},
    ],
    aWeek:[],
    curCheckDay:0,//当前选中天
  },

  clickDayItem:function(e){
    this.setData({
      curCheckDay:e.currentTarget.dataset.index
    })
  },

  close:function(e){
    wx.showModal({
      title: '提示',
      content: '是否结束本次预约？',
      success: function(res) {

          if (res.confirm) {
            // 用户点击确认
            
          } else if (res.cancel) {
            //用户点击取消
          }
      }

  })
  },

  clickChat:function(){
    wx.navigateTo({
      url: '/pages/person/chatDetail/chatDetail'
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var arr = []
    for (let i = 0; i < 7; i++) {
      arr.push(dealTime.dealTime(i))
    }
    arr[0].day = '今天'
    this.setData({
      aWeek: arr            // 赋值给data
    },()=>{
      console.log(this.data.aWeek)
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})